import { Button, FormItem,Form,Input,MessageBox, Message, MenuItem, Menu, Submenu, MenuItemGroup, Result, Breadcrumb, BreadcrumbItem, Select,Option, Card, Table, TableColumn,Switch, Pagination, Dialog,Tag,Tree,Upload,Icon,Cascader, Tabs, TabPane} from 'element-ui';
import MyTable from '@/components/Table'
import MyDialog from '@/components/Dialog';
import MyForm from '@/components/Form'
import DF from '@/components/DialogForm'
import Search from '@/components/Search'
export default {
    install(Vue){
        // Vue.use(Button);
        Vue.prototype.$mb = MessageBox;
        Vue.prototype.$confirm = (msg,title='提示')=>{
            return new promise((reslove,reject) =>{
                MessageBox.confirm(msg,title,{
                    beforeClose(action,instance) {
                        if(action === 'confirm'){
                            return reslove(instance.close);
                        }
                        if(action === 'cancel'){
                            reject();
                            instance.close();
                        }
                    }
                });
            });
        }
        Vue.prototype.$m = Message;
        /**
         * 注册自定义组件
         */
        [MyTable, MyDialog,MyForm,DF,Search].forEach(component=> Vue.component(component.name,component));
        [Button, Result,Tag,Select,Upload,Option,Tree, Dialog, Switch, Table, Pagination, TableColumn, Breadcrumb, BreadcrumbItem, Icon, Menu, Submenu, MenuItem, MenuItemGroup, Form, Input, FormItem,Card,Cascader,Tabs,TabPane,].forEach(component => Vue.use(component));
    }
}